package com.asp.config;

import com.asp.properties.AliTyProperties;
import com.asp.utils.AliTyUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * author:          ndg
 * date:            2024/1/10
 */
@Configuration
@Slf4j
public class TyConfiguration {
    @Bean//在项目启动的时候，执行方法
    @ConditionalOnMissingBean //当没有创建这个类的时候才创建
    public AliTyUtils aliTyUtil(AliTyProperties aliTyProperties) {
        log.info("开始创建阿里统一千问工具类对象,{}", aliTyProperties);
        return new AliTyUtils(aliTyProperties.getApiKey());
    }
}
